home *** CD-ROM | disk | FTP | other *** search
PiXCL source | 1996-05-13 | 16.4 KB | 707 lines |
- {-----------------------------COLBRFONT.pxl---------------------------------
- This program draws a variety of graphic shapes. It illustrates how you
- can control the background color, the brush color and fill pattern,
- they line pattern and color, as well as the font style and color.
- ------------------------------------------------------------------------}
-
- {Check Windows Version to Establish Font }
- WinVersion(Major_No,Minor_No,Build)
- WinGetActive(Win$)
- If Major_No>3 then Win_Fnt$="Roman" | Ver=0 | Goto Init
- If Major_No<3 then Win_Fnt$="Roman" | Ver=0 | Goto Init
- If Minor_No=0 then Win_Fnt$="Roman" | Ver=0 | Goto Init
- Win_Fnt$="Times New Roman"
- Ver=1
-
- { variable}
- Init:
- Delay = 2000
- If Ver=1 Then Font_C$="&Courier New" | Font_T$="Ti&mes New Roman"
- If Ver=0 Then Font_C$="&Courier" | Font_T$="Tms Rmn"
-
- {Maximize the window and set its caption}
- UseCoordinates(PIXEL)
-
- WinGetActive(Windowname$)
- WinTitle(Windowname$,"PiXCL 4.0 Colors, Brushes and Fonts")
- WinLocate("PiXCL 4.0 Colors, Brushes and Fonts",200,100,780,500,result)
- UseCoordinates(METRIC)
- {Initialize variables}
- Br_Red=0 {Blue brush}
- Br_Green=0
- Br_Blue=255
- Curr_BrushC$="&Blue "
- Prev_BrushC$="&Blue "
- Br_Type=0 {Solid}
- Curr_BrushP$="&Solid"
- Prev_BrushP$="&Solid"
-
- Pen_Red=0 {Black pen}
- Pen_Green=0
- Pen_Blue=0
- Curr_PenC$="Blac&k "
- Prev_PenC$="Blac&k "
- Pen_Type=0 {Solid}
- Curr_PenP$="&Solid narrow"
- Prev_PenP$="&Solid narrow"
-
- Font_Red=0 {Black font}
- Font_Green=0
- Font_Blue=0
- Curr_FontC$="Blac&k "
- Prev_FontC$="Blac&k "
- Font_Type=9 {System font}
- Curr_Font$="&System"
- Prev_Font$="&System"
-
- B_Red=255 {White background}
- B_Green=255
- B_Blue=255
- Curr_BackC$="&White"
- Prev_BackC$="&White"
- B_Type=1 {Transparent}
-
- { Remove Menu Item }
- InfoMenu(REMOVE)
- { up the menu}
- WaitInput(100)
- SetMenu("&File",IGNORE,
- "E&xit!", Bye,
- ENDPOPUP,
- "&Brush",IGNORE,
- "&Solid", Brush_Solid,
- "Diagonal &Up", Brush_Diagonalup,
- "Diagonal &Down", Brush_Diagonaldown,
- "Dia&gonal Cross", Brush_Diagonalcross,
- "&Horizontal", Brush_Horizontal,
- "&Vertical", Brush_Vertical,
- "&Cross", Brush_Cross,
- "&Null ", Brush_Null,
- SEPARATOR,
- "&White ", Brush_White,
- "&Gray ", Brush_Gray,
- "&Red ", Brush_Red,
- "&Yellow ", Brush_Yel,
- "Gree&n ", Brush_Grn,
- "&Light Blue ", Brush_Ltblu,
- "&Blue ", Brush_Blue,
- "&Pink ", Brush_Pink,
- "Blac&k ", Brush_Black,
- ENDPOPUP,
- "&Pen",IGNORE,
- "&Solid narrow", Pen_Solid_Narrow,
- "Solid &thick", Pen_Solid_Thick,
- "&Dash", Pen_Dash,
- "D&ot", Pen_Dot,
- "Da&sh dot", Pen_Dashdot,
- "Dash do&t dot", Pen_Dashdotdot,
- "&Null", Pen_Null,
- SEPARATOR,
- "&White ", Pen_White,
- "&Gray ", Pen_Gray,
- "&Red ", Pen_Red,
- "&Yellow ", Pen_Yel,
- "Gree&n ", Pen_Grn,
- "&Light Blue ", Pen_Ltblu,
- "&Blue ", Pen_Blue,
- "&Pink ", Pen_Pink,
- "Blac&k ", Pen_Black,
- ENDPOPUP,
- "&Font",IGNORE,
- "&Terminal", Font_Terminal,
- "R&oman", Font_Roman,
- "&Script", Font_Script,
- "&Modern", Font_Modern,
- "&Helv", Font_Helv,
- Font_C$, Font_Courier,
- Font_T$, Font_TmsRmn,
- "S&ymbol", Font_Symbol,
- "&System", Font_System,
- SEPARATOR,
- "&White ", Font_White,
- "&Gray ", Font_Gray,
- "&Red ", Font_Red,
- "&Yellow ", Font_Yel,
- "Gree&n ", Font_Grn,
- "&Light Blue ", Font_Ltblu,
- "&Blue ", Font_Blue,
- "&Pink ", Font_Pink,
- "Blac&k ", Font_Black,
- ENDPOPUP,
- "Back&ground",IGNORE,
- "&White", Back_Col_White,
- "&Gray", Back_Col_Gray,
- "&Red", Back_Col_Red,
- "&Yellow", Back_Col_Yel,
- "Gree&n", Back_Col_Grn,
- "&Light Blue", Back_Col_Ltblu,
- "&Blue", Back_Col_Blue,
- "&Pink", Back_Col_Pink,
- "Blac&k", Back_Col_Black,
- ENDPOPUP,
- "&Help",Help,
- ENDPOPUP,
- "&About",About,
- ENDPOPUP)
-
- ChangeMenuItem(Curr_BrushC$,CHECK,temp)
- ChangeMenuItem(Curr_BrushP$,CHECK,temp)
- ChangeMenuItem(Curr_PenC$,CHECK,temp)
- ChangeMenuItem(Curr_PenP$,CHECK,temp)
- ChangeMenuItem(Curr_Font$,CHECK,temp)
- ChangeMenuItem(Curr_FontC$,CHECK,temp)
- ChangeMenuItem(Curr_BackC$,CHECK,temp)
-
- { the drawing tools}
- _Br: { the brush}
- If Br_Type = 0 Then UseBrush(SOLID,Br_Red,Br_Green,Br_Blue) | Goto _Pen
- If Br_Type = 1 Then UseBrush(DIAGONALUP,Br_Red,Br_Green,Br_Blue) | Goto _Pen
- If Br_Type = 2 Then UseBrush(DIAGONALDOWN,Br_Red,Br_Green,Br_Blue) | Goto _Pen
- If Br_Type = 3 Then UseBrush(DIAGONALCROSS,Br_Red,Br_Green,Br_Blue) | Goto _Pen
- If Br_Type = 4 Then UseBrush(HORIZONTAL,Br_Red,Br_Green,Br_Blue) | Goto _Pen
- If Br_Type = 5 Then UseBrush(VERTICAL,Br_Red,Br_Green,Br_Blue) | Goto _Pen
- If Br_Type = 6 Then UseBrush(CROSS,Br_Red,Br_Green,Br_Blue) | Goto _Pen
- {Else} UseBrush(NULL,Br_Red,Br_Green,Br_Blue)
-
- _Pen: { the pen}
- If Pen_Type = 0 Then UsePen(SOLID,1,Pen_Red,Pen_Green,Pen_Blue) | Goto _Font
- If Pen_Type = 1 Then UsePen(SOLID,3,Pen_Red,Pen_Green,Pen_Blue) | Goto _Font
- If Pen_Type = 2 Then UsePen(DASH,1,Pen_Red,Pen_Green,Pen_Blue) | Goto _Font
- If Pen_Type = 3 Then UsePen(DOT,1,Pen_Red,Pen_Green,Pen_Blue) | Goto _Font
- If Pen_Type = 4 Then UsePen(DASHDOT,1,Pen_Red,Pen_Green,Pen_Blue) | Goto _Font
- If Pen_Type = 5 Then UsePen(DASHDOTDOT,1,Pen_Red,Pen_Green,Pen_Blue) | Goto _Font
- {ELSE} UsePen(NULL,1,Pen_Red,Pen_Green,Pen_Blue) | Goto _Font
-
- _Font: {Establish the font}
- If Font_Type = 0 Then UseFont("Terminal",0,0,NOBOLD,NOITALIC,NOUNDERLINE,Font_Red,Font_Green,Font_Blue) | Goto Draw:
- If Font_Type = 1 Then UseFont("Roman",0,0,NOBOLD,NOITALIC,NOUNDERLINE,Font_Red,Font_Green,Font_Blue) | Goto Draw:
- If Font_Type = 2 Then UseFont("Script",3,0,NOBOLD,NOITALIC,NOUNDERLINE,Font_Red,Font_Green,Font_Blue) | Goto Draw:
- If Font_Type = 3 Then UseFont("Modern",0,0,NOBOLD,NOITALIC,NOUNDERLINE,Font_Red,Font_Green,Font_Blue) | Goto Draw:
- If Font_Type = 4 Then UseFont("Helv",0,0,NOBOLD,NOITALIC,NOUNDERLINE,Font_Red,Font_Green,Font_Blue) | Goto Draw:
- If Font_Type = 5 Then If Ver=0 Then UseFont("Courier",0,0,NOBOLD,NOITALIC,NOUNDERLINE,Font_Red,Font_Green,Font_Blue) | Goto Draw:
- If Font_Type = 5 Then If Ver=1 Then UseFont("Courier New",0,0,NOBOLD,NOITALIC,NOUNDERLINE,Font_Red,Font_Green,Font_Blue) | Goto Draw:
- If Font_Type = 6 Then If Ver=0 Then UseFont("Tms Rmn",0,0,NOBOLD,NOITALIC,NOUNDERLINE,Font_Red,Font_Green,Font_Blue) | Goto Draw:
- If Font_Type = 6 Then If Ver=1 Then UseFont("Times New Roman",0,0,NOBOLD,NOITALIC,NOUNDERLINE,Font_Red,Font_Green,Font_Blue) | Goto Draw:
- If Font_Type = 7 Then UseFont("Symbol",0,0,NOBOLD,NOITALIC,NOUNDERLINE,Font_Red,Font_Green,Font_Blue) | Goto Draw:
- {ELSE} UseFont("System",0,0,NOBOLD,NOITALIC,NOUNDERLINE,Font_Red,Font_Green,Font_Blue)
-
- Draw:
- UseBackground(TRANSPARENT,B_Red,B_Green,B_Blue)
- DrawBackground
-
- DrawPie(0,10,45,40,40,30,13,12)
- DrawText(27,40,"Pie")
- DrawChord(45,10,90,40,85,30,58,12)
- DrawText(67,40,"Chord")
- DrawArc(90,10,135,40,130,30,103,12)
- DrawText(112,40,"Arc")
- DrawLine(150,10,180,32)
- DrawText(157,40,"Line")
-
- DrawEllipse(10,60,55,90)
- DrawText(25,93,"Ellipse")
- DrawRectangle(69,60,114,90)
- DrawText(81,93,"Rectangle")
- DrawRoundRectangle(128,60,173,90,6,6)
- DrawText(133,93,"Round Rectangle")
-
- Wait_for_input:
- WaitInput()
-
- Help:
- MessageBox(OK,1,INFORMATION,
- "This sample program demonstrates the Windows GDI
- functions available in PiXCL 4.0. When you select
- any of the menu options for brushes, pens fonts
- and backgrounds, the client area is redrawn with
- the new parameters.",
- "Some Windows GDI functions.",Res)
- Goto Wait_for_input
-
- About:
- AboutUser("PiXCL 4.0 Sample Program",
- "Colors, Brushes, Pens and Fonts", "")
-
- Goto Wait_for_input
-
-
- Brush_Solid:
- Curr_BrushP$="&Solid"
- Gosub Brush_Pattern
- Br_Type = 0
- Goto _Br
-
- Brush_Diagonalup:
- Curr_BrushP$="Diagonal &Up"
- Gosub Brush_Pattern
- Br_Type = 1
- Goto _Br
-
- Brush_Diagonaldown:
- Curr_BrushP$="Diagonal &Down"
- Gosub Brush_Pattern
- Br_Type = 2
- Goto _Br
-
- Brush_Diagonalcross:
- Curr_BrushP$="Diagonal &Cross"
- Gosub Brush_Pattern
- Br_Type = 3
- Goto _Br
-
- Brush_Horizontal:
- Curr_BrushP$="&Horizontal"
- Gosub Brush_Pattern
- Br_Type = 4
- Goto _Br
-
- Brush_Vertical:
- Curr_BrushP$="&Vertical"
- Gosub Brush_Pattern
- Br_Type = 5
- Goto _Br
-
- Brush_Cross:
- Curr_BrushP$="&Cross"
- Gosub Brush_Pattern
- Br_Type = 6
- Goto _Br
-
- Brush_Null:
- Curr_BrushP$="&Null "
- Gosub Brush_Pattern
- Br_Type = 7
- Goto _Br
-
- Brush_White:
- Curr_BrushC$="&White "
- Gosub Brush_Color
- Br_Red = 255
- Br_Green = 255
- Br_Blue = 255
- Goto _Br
-
- Brush_Gray:
- Curr_BrushC$="&Gray "
- Gosub Brush_Color
- Br_Red = 192
- Br_Green = 192
- Br_Blue = 192
- Goto _Br
-
- Brush_Red:
- Curr_BrushC$="&Red "
- Gosub Brush_Color
- Br_Red = 255
- Br_Green = 0
- Br_Blue = 0
- Goto _Br
-
- Brush_Yel:
- Curr_BrushC$="&Yellow "
- Gosub Brush_Color
- Br_Red = 255
- Br_Green = 255
- Br_Blue = 0
- Goto _Br
-
- Brush_Grn:
- Curr_BrushC$="Gree&n "
- Gosub Brush_Color
- Br_Red = 0
- Br_Green = 255
- Br_Blue = 0
- Goto _Br
-
- Brush_Ltblu:
- Curr_BrushC$="&Light Blue "
- Gosub Brush_Color
- Br_Red = 0
- Br_Green = 255
- Br_Blue = 255
- Goto _Br
-
- Brush_Blue:
- Curr_BrushC$="&Blue "
- Gosub Brush_Color
- Br_Red = 0
- Br_Green = 0
- Br_Blue = 255
- Goto _Br
-
- Brush_Pink:
- Curr_BrushC$="&Pink "
- Gosub Brush_Color
- Br_Red = 255
- Br_Green = 0
- Br_Blue = 255
- Goto _Br
-
- Brush_Black:
- Curr_BrushC$="Blac&k "
- Gosub Brush_Color
- Br_Red = 0
- Br_Green = 0
- Br_Blue = 0
- Goto _Br
-
- Pen_Solid_Narrow:
- Curr_PenP$="&Solid narrow"
- Gosub Pen_Pattern
- Pen_Type = 0
- Goto _Pen
-
- Pen_Solid_Thick:
- Curr_PenP$="Solid &thick"
- Gosub Pen_Pattern
- Pen_Type = 1
- Goto _Pen
-
- Pen_Dash:
- Curr_PenP$="&Dash"
- Gosub Pen_Pattern
- Pen_Type = 2
- Goto _Pen
-
- Pen_Dot:
- Curr_PenP$="D&ot"
- Gosub Pen_Pattern
- Pen_Type = 3
- Goto _Pen
-
- Pen_Dashdot:
- Curr_PenP$="Da&sh dot"
- Gosub Pen_Pattern
- Pen_Type = 4
- Goto _Pen
-
- Pen_Dashdotdot:
- Curr_PenP$="Dash do&t dot"
- Gosub Pen_Pattern
- Pen_Type = 5
- Goto _Pen
-
- Pen_Null:
- Curr_PenP$="&Null"
- Gosub Pen_Pattern
- Pen_Type = 6
- Goto _Pen
-
- Pen_White:
- Curr_PenC$="&White "
- Gosub Pen_Color
- Pen_Red = 255
- Pen_Green = 255
- Pen_Blue = 255
- Goto _Pen
-
- Pen_Gray:
- Curr_PenC$="&Gray "
- Gosub Pen_Color
- Pen_Red = 192
- Pen_Green = 192
- Pen_Blue = 192
- Goto _Pen
-
- Pen_Red:
- Curr_PenC$="&Red "
- Gosub Pen_Color
- Pen_Red = 255
- Pen_Green = 0
- Pen_Blue = 0
- Goto _Pen
-
- Pen_Yel:
- Curr_PenC$="&Yellow "
- Gosub Pen_Color
- Pen_Red = 255
- Pen_Green = 255
- Pen_Blue = 0
- Goto _Pen
-
- Pen_Grn:
- Curr_PenC$="Gree&n "
- Gosub Pen_Color
- Pen_Red = 0
- Pen_Green = 255
- Pen_Blue = 0
- Goto _Pen
-
- Pen_Ltblu:
- Curr_PenC$="&Light Blue "
- Gosub Pen_Color
- Pen_Red = 0
- Pen_Green = 255
- Pen_Blue = 255
- Goto _Pen
-
- Pen_Blue:
- Curr_PenC$="&Blue "
- Gosub Pen_Color
- Pen_Red = 0
- Pen_Green = 0
- Pen_Blue = 255
- Goto _Pen
-
- Pen_Pink:
- Curr_PenC$="&Pink "
- Gosub Pen_Color
- Pen_Red = 255
- Pen_Green = 0
- Pen_Blue = 255
- Goto _Pen
-
- Pen_Black:
- Curr_PenC$="Blac&k "
- Gosub Pen_Color
- Pen_Red = 0
- Pen_Green = 0
- Pen_Blue = 0
- Goto _Pen
-
- Font_Terminal:
- Curr_Font$="&Terminal"
- Gosub Font_Type
- Font_Type = 0
- Goto _Font
-
- Font_Roman:
- Curr_Font$="R&oman"
- Gosub Font_Type
- Font_Type = 1
- Goto _Font
-
- Font_Script:
- Curr_Font$="&Script"
- Gosub Font_Type
- Font_Type = 2
- Goto _Font
-
- Font_Modern:
- Curr_Font$="&Modern"
- Gosub Font_Type
- Font_Type = 3
- Goto _Font
-
- Font_Helv:
- Curr_Font$="&Helv"
- Gosub Font_Type
- Font_Type = 4
- Goto _Font
-
- Font_Courier:
- If Ver=0 Then Curr_Font$="&Courier"
- If Ver=1 Then Curr_Font$="&Courier New"
- Gosub Font_Type
- Font_Type = 5
- Goto _Font
-
- Font_TmsRmn:
- If Ver=0 Then Curr_Font$="T&ms Rmn"
- If Ver=1 Then Curr_Font$="Ti&mes New Roman"
- Gosub Font_Type
- Font_Type = 6
- Goto _Font
-
- Font_Symbol:
- Curr_Font$="S&ymbol"
- Gosub Font_Type
- Font_Type = 7
- Goto _Font
-
- Font_System:
- Curr_Font$="&System"
- Gosub Font_Type
- Font_Type = 9
- Goto _Font
-
- Font_White:
- Curr_FontC$="&White "
- Gosub Font_Color
- Font_Red = 255
- Font_Green = 255
- Font_Blue = 255
- Goto _Font
-
- Font_Gray:
- Curr_FontC$="&Gray "
- Gosub Font_Color
- Font_Red = 192
- Font_Green = 192
- Font_Blue = 192
- Goto _Font
-
- Font_Red:
- Curr_FontC$="&Red "
- Gosub Font_Color
- Font_Red = 255
- Font_Green = 0
- Font_Blue = 0
- Goto _Font
-
- Font_Yel:
- Curr_FontC$="&Yellow "
- Gosub Font_Color
- Font_Red = 255
- Font_Green = 255
- Font_Blue = 0
- Goto _Font
-
- Font_Grn:
- Curr_FontC$="Gree&n "
- Gosub Font_Color
- Font_Red = 0
- Font_Green = 255
- Font_Blue = 0
- Goto _Font
-
- Font_Ltblu:
- Curr_FontC$="&Light Blue "
- Gosub Font_Color
- Font_Red = 0
- Font_Green = 255
- Font_Blue = 255
- Goto _Font
-
- Font_Blue:
- Curr_FontC$="&Blue "
- Gosub Font_Color
- Font_Red = 0
- Font_Green = 0
- Font_Blue = 255
- Goto _Font
-
- Font_Pink:
- Curr_FontC$="&Pink "
- Gosub Font_Color
- Font_Red = 255
- Font_Green = 0
- Font_Blue = 255
- Goto _Font
-
- Font_Black:
- Curr_FontC$="Blac&k "
- Gosub Font_Color
- Font_Red = 0
- Font_Green = 0
- Font_Blue = 0
- Goto _Font
-
- Back_Col_White:
- Curr_BackC$="&White"
- Gosub Back_Color
- B_Red = 255
- B_Green = 255
- B_Blue = 255
- Goto Draw
-
- Back_Col_Gray:
- Curr_BackC$="&Gray"
- Gosub Back_Color
- B_Red = 192
- B_Green = 192
- B_Blue = 192
- Goto Draw
-
- Back_Col_Red:
- Curr_BackC$="&Red"
- Gosub Back_Color
- B_Red = 255
- B_Green = 0
- B_Blue = 0
- Goto Draw
-
- Back_Col_Yel:
- Curr_BackC$="&Yellow"
- Gosub Back_Color
- B_Red = 255
- B_Green = 255
- B_Blue = 0
- Goto Draw
-
- Back_Col_Grn:
- Curr_BackC$="Gree&n"
- Gosub Back_Color
- B_Red = 0
- B_Green = 255
- B_Blue = 0
- Goto Draw
-
- Back_Col_Ltblu:
- Curr_BackC$="&Light Blue"
- Gosub Back_Color
- B_Red = 0
- B_Green = 255
- B_Blue = 255
- Goto Draw
-
- Back_Col_Blue:
- Curr_BackC$="&Blue"
- Gosub Back_Color
- B_Red = 0
- B_Green = 0
- B_Blue = 255
- Goto Draw
-
- Back_Col_Pink:
- Curr_BackC$="&Pink"
- Gosub Back_Color
- B_Red = 255
- B_Green = 0
- B_Blue = 255
- Goto Draw
-
- Back_Col_Black:
- Curr_BackC$="Blac&k"
- Gosub Back_Color
- B_Red = 0
- B_Green = 0
- B_Blue = 0
- Goto Draw
-
- Brush_Color:
- ChangeMenuItem(Prev_BrushC$,UNCHECK,temp)
- ChangeMenuItem(Curr_BrushC$,CHECK,temp)
- Prev_BrushC$=Curr_BrushC$
- Return
-
- Brush_Pattern:
- ChangeMenuItem(Prev_BrushP$,UNCHECK,temp)
- ChangeMenuItem(Curr_BrushP$,CHECK,temp)
- Prev_BrushP$=Curr_BrushP$
- Return
-
- Pen_Color:
- ChangeMenuItem(Prev_PenC$,UNCHECK,temp)
- ChangeMenuItem(Curr_PenC$,CHECK,temp)
- Prev_PenC$=Curr_PenC$
- Return
-
- Pen_Pattern:
- ChangeMenuItem(Prev_PenP$,UNCHECK,temp)
- ChangeMenuItem(Curr_PenP$,CHECK,temp)
- Prev_PenP$=Curr_PenP$
- Return
-
- Font_Color:
- ChangeMenuItem(Prev_FontC$,UNCHECK,temp)
- ChangeMenuItem(Curr_FontC$,CHECK,temp)
- Prev_FontC$=Curr_FontC$
- Return
-
- Font_Type:
- ChangeMenuItem(Prev_Font$,UNCHECK,temp)
- ChangeMenuItem(Curr_Font$,CHECK,temp)
- Prev_Font$=Curr_Font$
- Return
-
- Back_Color:
- ChangeMenuItem(Prev_BackC$,UNCHECK,temp)
- ChangeMenuItem(Curr_BackC$,CHECK,temp)
- Prev_BackC$=Curr_BackC$
- Return
-
- Bye:
- End
-
-